package com.template.mongo.persistence.dao.base;

import java.util.List;
import java.util.Map;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.query.Query;

import com.template.mongo.model.BaseBean;
import com.template.mongo.utils.PagingInfo;

public interface GenericMongoBaseDao<T extends BaseBean> {
	/**
	 * Get the Class of the entity.
	 * 
	 * @return the class
	 */
	Class<T> getEntityClass();

	void save(T bean);
	
	void update(T bean);

	void delete(T bean);
	
	T findById(ObjectId id);

	T findOne(Map<String, Object> map);
	
	T findOne(T bean);
	
	T findOne(Query query);
	
	/**
	 * Count entity
	 * @return number of all items according to condition
	 */
	Long count(Query query);
	
	List<T> findAll();
	
	List<T> findAll(PagingInfo pInfo);
}